package com.jyb.util;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class EncoderUtil {
	
public String EncoderByMd5(String str) throws NoSuchAlgorithmException, UnsupportedEncodingException{
    	MessageDigest md5 = MessageDigest.getInstance("MD5");
        byte[] bytes = md5.digest(str.getBytes());
        String result = "";
        for(byte b : bytes)
        {
            String temp = Integer.toHexString(b & 0xff);
            if(temp.length() == 1)
            {
                temp = "0" + temp;
            }
            result = result + temp;
        }
        System.out.println(result);
    	return result;
    }

}
